/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.com.cotelasa.scp.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author WINDOWS 7
 */
@Entity
@Table(name = "gasto_aduana",catalog = "bdcotelasa", schema = "cotelasa")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "GastoAduana.findAll", query = "SELECT g FROM GastoAduana g"),
    @NamedQuery(name = "GastoAduana.findById", query = "SELECT g FROM GastoAduana g WHERE g.id = :id"),
    @NamedQuery(name = "GastoAduana.findByDocumento", query = "SELECT g FROM GastoAduana g WHERE g.documento = :documento"),
    @NamedQuery(name = "GastoAduana.findByConcepto", query = "SELECT g FROM GastoAduana g WHERE g.concepto = :concepto"),
    @NamedQuery(name = "GastoAduana.findByTotalSoles", query = "SELECT g FROM GastoAduana g WHERE g.totalSoles = :totalSoles"),
    @NamedQuery(name = "GastoAduana.findByTipoCambio", query = "SELECT g FROM GastoAduana g WHERE g.tipoCambio = :tipoCambio"),
    @NamedQuery(name = "GastoAduana.findByTotalDolares", query = "SELECT g FROM GastoAduana g WHERE g.totalDolares = :totalDolares"),
    @NamedQuery(name = "GastoAduana.findByIgv", query = "SELECT g FROM GastoAduana g WHERE g.igv = :igv"),
    @NamedQuery(name = "GastoAduana.findByTotal", query = "SELECT g FROM GastoAduana g WHERE g.total = :total"),
    @NamedQuery(name = "GastoAduana.findByEstadoRegistro", query = "SELECT g FROM GastoAduana g WHERE g.estadoRegistro = :estadoRegistro"),
    @NamedQuery(name = "GastoAduana.findByUsrCreacion", query = "SELECT g FROM GastoAduana g WHERE g.usrCreacion = :usrCreacion"),
    @NamedQuery(name = "GastoAduana.findByFecCreacion", query = "SELECT g FROM GastoAduana g WHERE g.fecCreacion = :fecCreacion"),
    @NamedQuery(name = "GastoAduana.findByUsrModificacion", query = "SELECT g FROM GastoAduana g WHERE g.usrModificacion = :usrModificacion"),
    @NamedQuery(name = "GastoAduana.findByFecModificacion", query = "SELECT g FROM GastoAduana g WHERE g.fecModificacion = :fecModificacion")})
public class GastoAduana implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name = "generadorGastoAduana", sequenceName = "cotelasa.gasto_aduana_id_seq")
    @GeneratedValue(generator = "generadorGastoAduana")
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "documento")
    private String documento;
    
    @Size( max = 200)
    @Column(name = "concepto")
    private String concepto;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "tiene_igv")
    private short tieneIgv;
    
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "total_soles")
    private BigDecimal totalSoles;
    
    @Column(name = "tipo_cambio")
    private BigDecimal tipoCambio;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "total_dolares")
    private BigDecimal totalDolares;
    
    @Column(name = "igv")
    private BigDecimal igv;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "total")
    private BigDecimal total;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "estado_registro")
    private char estadoRegistro;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "usr_creacion")
    private String usrCreacion;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "fec_creacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecCreacion;
    
    @Size(max = 20)
    @Column(name = "usr_modificacion")
    private String usrModificacion;
    
    @Column(name = "fec_modificacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecModificacion;
    
    @JoinColumn(name = "id_moneda", referencedColumnName = "id")
    
    @ManyToOne(optional = false)
    private TipoMoneda idMoneda;
    
    @JoinColumn(name = "id_proveedor", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Proveedor idProveedor;
    
    @JoinColumn(name = "id_costeo_importacion", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private CosteoImportacion idCosteoImportacion;

    public GastoAduana() {
    }

    public GastoAduana(Integer id) {
        this.id = id;
    }

    public GastoAduana(Integer id, String documento, String concepto, BigDecimal totalSoles, BigDecimal tipoCambio, BigDecimal totalDolares, BigDecimal igv, BigDecimal total, char estadoRegistro, String usrCreacion, Date fecCreacion) {
        this.id = id;
        this.documento = documento;
        this.concepto = concepto;
        this.totalSoles = totalSoles;
        this.tipoCambio = tipoCambio;
        this.totalDolares = totalDolares;
        this.igv = igv;
        this.total = total;
        this.estadoRegistro = estadoRegistro;
        this.usrCreacion = usrCreacion;
        this.fecCreacion = fecCreacion;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDocumento() {
        return documento;
    }

    public void setDocumento(String documento) {
        this.documento = documento;
    }

    public String getConcepto() {
        return concepto;
    }

    public void setConcepto(String concepto) {
        this.concepto = concepto;
    }

    public BigDecimal getTotalSoles() {
        return totalSoles;
    }

    public void setTotalSoles(BigDecimal totalSoles) {
        this.totalSoles = totalSoles;
    }

    public BigDecimal getTipoCambio() {
        return tipoCambio;
    }

    public void setTipoCambio(BigDecimal tipoCambio) {
        this.tipoCambio = tipoCambio;
    }

    public BigDecimal getTotalDolares() {
        return totalDolares;
    }

    public void setTotalDolares(BigDecimal totalDolares) {
        this.totalDolares = totalDolares;
    }

    public BigDecimal getIgv() {
        return igv;
    }

    public void setIgv(BigDecimal igv) {
        this.igv = igv;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    public char getEstadoRegistro() {
        return estadoRegistro;
    }

    public void setEstadoRegistro(char estadoRegistro) {
        this.estadoRegistro = estadoRegistro;
    }

    public String getUsrCreacion() {
        return usrCreacion;
    }

    public void setUsrCreacion(String usrCreacion) {
        this.usrCreacion = usrCreacion;
    }

    public Date getFecCreacion() {
        return fecCreacion;
    }

    public void setFecCreacion(Date fecCreacion) {
        this.fecCreacion = fecCreacion;
    }

    public String getUsrModificacion() {
        return usrModificacion;
    }

    public void setUsrModificacion(String usrModificacion) {
        this.usrModificacion = usrModificacion;
    }

    public Date getFecModificacion() {
        return fecModificacion;
    }

    public void setFecModificacion(Date fecModificacion) {
        this.fecModificacion = fecModificacion;
    }

    public TipoMoneda getIdMoneda() {
        return idMoneda;
    }

    public void setIdMoneda(TipoMoneda idMoneda) {
        this.idMoneda = idMoneda;
    }

    public Proveedor getIdProveedor() {
        return idProveedor;
    }

    public void setIdProveedor(Proveedor idProveedor) {
        this.idProveedor = idProveedor;
    }

    public CosteoImportacion getIdCosteoImportacion() {
        return idCosteoImportacion;
    }

    public void setIdCosteoImportacion(CosteoImportacion idCosteoImportacion) {
        this.idCosteoImportacion = idCosteoImportacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GastoAduana)) {
            return false;
        }
        GastoAduana other = (GastoAduana) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.com.cotelasa.scp.entidad.GastoAduana[ id=" + id + " ]";
    }

    public short getTieneIgv() {
        return tieneIgv;
    }

    public void setTieneIgv(short tieneIgv) {
        this.tieneIgv = tieneIgv;
    }
    
}
